home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / anticamp.zip / CLIENT.QC < prev    next >
Text File  |  1996-10-13  |  36KB  |  1,507 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float    modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float    intermission_running;
  21. float    intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35. // remove items
  36.     self.items = self.items - (self.items & 
  37.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  38.     
  39. // cap super health
  40.     if (self.health > 100)
  41.         self.health = 100;
  42.     if (self.health < 50)
  43.         self.health = 50;
  44.     parm1 = self.items;
  45.     parm2 = self.health;
  46.     parm3 = self.armorvalue;
  47.     if (self.ammo_shells < 25)
  48.         parm4 = 25;
  49.     else
  50.         parm4 = self.ammo_shells;
  51.     parm5 = self.ammo_nails;
  52.     parm6 = self.ammo_rockets;
  53.     parm7 = self.ammo_cells;
  54.     parm8 = self.weapon;
  55.     parm9 = self.armortype * 100;
  56. };
  57.  
  58. void() SetNewParms =
  59. {
  60.     parm1 = IT_SHOTGUN | IT_AXE;
  61.     parm2 = 100;
  62.     parm3 = 0;
  63.     parm4 = 25;
  64.     parm5 = 0;
  65.     parm6 = 0;
  66.     parm6 = 0;
  67.     parm8 = 1;
  68.     parm9 = 0;
  69. };
  70.  
  71. void() DecodeLevelParms =
  72. {
  73.     if (serverflags)
  74.     {
  75.         if (world.model == "maps/start.bsp")
  76.             SetNewParms ();        // take away all stuff on starting new episode
  77.     }
  78.     
  79.     self.items = parm1;
  80.     self.health = parm2;
  81.     self.armorvalue = parm3;
  82.     self.ammo_shells = parm4;
  83.     self.ammo_nails = parm5;
  84.     self.ammo_rockets = parm6;
  85.     self.ammo_cells = parm7;
  86.     self.weapon = parm8;
  87.     self.armortype = parm9 * 0.01;
  88. };
  89.  
  90. /*
  91. ============
  92. FindIntermission
  93.  
  94. Returns the entity to view from
  95. ============
  96. */
  97. entity() FindIntermission =
  98. {
  99.     local    entity spot;
  100.     local    float cyc;
  101.  
  102. // look for info_intermission first
  103.     spot = find (world, classname, "info_intermission");
  104.     if (spot)
  105.     {    // pick a random one
  106.         cyc = random() * 4;
  107.         while (cyc > 1)
  108.         {
  109.             spot = find (spot, classname, "info_intermission");
  110.             if (!spot)
  111.                 spot = find (spot, classname, "info_intermission");
  112.             cyc = cyc - 1;
  113.         }
  114.         return spot;
  115.     }
  116.  
  117. // then look for the start position
  118.     spot = find (world, classname, "info_player_start");
  119.     if (spot)
  120.         return spot;
  121.     
  122. // testinfo_player_start is only found in regioned levels
  123.     spot = find (world, classname, "testplayerstart");
  124.     if (spot)
  125.         return spot;
  126.     
  127.     objerror ("FindIntermission: no spot");
  128. };
  129.  
  130.  
  131. string nextmap;
  132. void() GotoNextMap =
  133. {
  134.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  135.         changelevel (mapname);
  136.     else
  137.         changelevel (nextmap);
  138. };
  139.  
  140.  
  141. void() ExitIntermission =
  142. {
  143. // skip any text in deathmatch
  144.     if (deathmatch)
  145.     {
  146.         GotoNextMap ();
  147.         return;
  148.     }
  149.     
  150.     intermission_exittime = time + 1;
  151.     intermission_running = intermission_running + 1;
  152.  
  153. //
  154. // run some text if at the end of an episode
  155. //
  156.     if (intermission_running == 2)
  157.     {
  158.         if (world.model == "maps/e1m7.bsp")
  159.         {
  160.             WriteByte (MSG_ALL, SVC_CDTRACK);
  161.             WriteByte (MSG_ALL, 2);
  162.             WriteByte (MSG_ALL, 3);
  163.             if (!cvar("registered"))
  164.             {
  165.                 WriteByte (MSG_ALL, SVC_FINALE);
  166.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  167.             }
  168.             else
  169.             {
  170.                 WriteByte (MSG_ALL, SVC_FINALE);
  171.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  172.             }
  173.             return;
  174.         }
  175.         else if (world.model == "maps/e2m6.bsp")
  176.         {
  177.             WriteByte (MSG_ALL, SVC_CDTRACK);
  178.             WriteByte (MSG_ALL, 2);
  179.             WriteByte (MSG_ALL, 3);
  180.  
  181.             WriteByte (MSG_ALL, SVC_FINALE);
  182.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  183.             return;
  184.         }
  185.         else if (world.model == "maps/e3m6.bsp")
  186.         {
  187.             WriteByte (MSG_ALL, SVC_CDTRACK);
  188.             WriteByte (MSG_ALL, 2);
  189.             WriteByte (MSG_ALL, 3);
  190.  
  191.             WriteByte (MSG_ALL, SVC_FINALE);
  192.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  193.             return;
  194.         }
  195.         else if (world.model == "maps/e4m7.bsp")
  196.         {
  197.             WriteByte (MSG_ALL, SVC_CDTRACK);
  198.             WriteByte (MSG_ALL, 2);
  199.             WriteByte (MSG_ALL, 3);
  200.  
  201.             WriteByte (MSG_ALL, SVC_FINALE);
  202.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  203.             return;
  204.         }
  205.  
  206.         GotoNextMap();
  207.     }
  208.     
  209.     if (intermission_running == 3)
  210.     {
  211.         if (!cvar("registered"))
  212.         {    // shareware episode has been completed, go to sell screen
  213.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  214.             return;
  215.         }
  216.         
  217.         if ( (serverflags&15) == 15)
  218.         {
  219.             WriteByte (MSG_ALL, SVC_FINALE);
  220.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  221.             return;
  222.         }
  223.         
  224.     }
  225.  
  226.     GotoNextMap();
  227. };
  228.  
  229. /*
  230. ============
  231. IntermissionThink
  232.  
  233. When the player presses attack or jump, change to the next level
  234. ============
  235. */
  236. void() IntermissionThink =
  237. {
  238.     if (time < intermission_exittime)
  239.         return;
  240.  
  241.     if (!self.button0 && !self.button1 && !self.button2)
  242.         return;
  243.     
  244.     ExitIntermission ();
  245. };
  246.  
  247. void() execute_changelevel =
  248. {
  249.     local entity    pos;
  250.  
  251.     intermission_running = 1;
  252.     
  253. // enforce a wait time before allowing changelevel
  254.     if (deathmatch)
  255.         intermission_exittime = time + 5;
  256.     else
  257.         intermission_exittime = time + 2;
  258.  
  259.     WriteByte (MSG_ALL, SVC_CDTRACK);
  260.     WriteByte (MSG_ALL, 3);
  261.     WriteByte (MSG_ALL, 3);
  262.     
  263.     pos = FindIntermission ();
  264.  
  265.     other = find (world, classname, "player");
  266.     while (other != world)
  267.     {
  268.         other.view_ofs = '0 0 0';
  269.         other.angles = other.v_angle = pos.mangle;
  270.         other.fixangle = TRUE;        // turn this way immediately
  271.         other.nextthink = time + 0.5;
  272.         other.takedamage = DAMAGE_NO;
  273.         other.solid = SOLID_NOT;
  274.         other.movetype = MOVETYPE_NONE;
  275.         other.modelindex = 0;
  276.         setorigin (other, pos.origin);
  277.         other = find (other, classname, "player");
  278.     }    
  279.  
  280.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  281. };
  282.  
  283.  
  284. void() changelevel_touch =
  285. {
  286.     local entity    pos;
  287.  
  288.     if (other.classname != "player")
  289.         return;
  290.  
  291.     if (cvar("noexit"))
  292.     {
  293.         T_Damage (other, self, self, 50000);
  294.         return;
  295.     }
  296.     bprint (other.netname);
  297.     bprint (" exited the level\n");
  298.     
  299.     nextmap = self.map;
  300.  
  301.     SUB_UseTargets ();
  302.  
  303.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  304.     {    // NO_INTERMISSION
  305.         GotoNextMap();
  306.         return;
  307.     }
  308.     
  309.     self.touch = SUB_Null;
  310.  
  311. // we can't move people right now, because touch functions are called
  312. // in the middle of C movement code, so set a think time to do it
  313.     self.think = execute_changelevel;
  314.     self.nextthink = time + 0.1;
  315. };
  316.  
  317. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  318. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  319. */
  320. void() trigger_changelevel =
  321. {
  322.     if (!self.map)
  323.         objerror ("chagnelevel trigger doesn't have map");
  324.     
  325.     InitTrigger ();
  326.     self.touch = changelevel_touch;
  327. };
  328.  
  329.  
  330. /*
  331. =============================================================================
  332.  
  333.                 PLAYER GAME EDGE FUNCTIONS
  334.  
  335. =============================================================================
  336. */
  337.  
  338. void() set_suicide_frame;
  339.  
  340. // called by ClientKill and DeadThink
  341. void() respawn =
  342. {
  343.     if (coop)
  344.     {
  345.         // make a copy of the dead body for appearances sake
  346.         CopyToBodyQue (self);
  347.         // get the spawn parms as they were at level start
  348.         setspawnparms (self);
  349.         // respawn        
  350.         PutClientInServer ();
  351.     }
  352.     else if (deathmatch)
  353.     {
  354.         // make a copy of the dead body for appearances sake
  355.         CopyToBodyQue (self);
  356.         // set default spawn parms
  357.         SetNewParms ();
  358.         // respawn        
  359.         PutClientInServer ();
  360.     }
  361.     else
  362.     {    // restart the entire server
  363.         localcmd ("restart\n");
  364.     }
  365. };
  366.  
  367.  
  368. /*
  369. ============
  370. ClientKill
  371.  
  372. Player entered the suicide command
  373. ============
  374. */
  375. void() ClientKill =
  376. {
  377.     bprint (self.netname);
  378.     bprint (" suicides\n");
  379.     set_suicide_frame ();
  380.     self.modelindex = modelindex_player;
  381.     self.frags = self.frags - 2;    // extra penalty
  382.     respawn ();
  383. };
  384.  
  385. float(vector v) CheckSpawnPoint =
  386. {
  387.     return FALSE;
  388. };
  389.  
  390. /*
  391. ============
  392. SelectSpawnPoint
  393.  
  394. Returns the entity to spawn at
  395. ============
  396. */
  397. entity() SelectSpawnPoint =
  398. {
  399.     local    entity spot;
  400.     
  401. // testinfo_player_start is only found in regioned levels
  402.     spot = find (world, classname, "testplayerstart");
  403.     if (spot)
  404.         return spot;
  405.         
  406. // choose a info_player_deathmatch point
  407.     if (coop)
  408.     {
  409.         lastspawn = find(lastspawn, classname, "info_player_coop");
  410.         if (lastspawn == world)
  411.             lastspawn = find (lastspawn, classname, "info_player_start");
  412.         if (lastspawn != world)
  413.             return lastspawn;
  414.     }
  415.     else if (deathmatch)
  416.     {
  417.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  418.         if (lastspawn == world)
  419.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  420.         if (lastspawn != world)
  421.             return lastspawn;
  422.     }
  423.  
  424.     if (serverflags)
  425.     {    // return with a rune to start
  426.         spot = find (world, classname, "info_player_start2");
  427.         if (spot)
  428.             return spot;
  429.     }
  430.     
  431.     spot = find (world, classname, "info_player_start");
  432.     if (!spot)
  433.         error ("PutClientInServer: no info_player_start on level");
  434.     
  435.     return spot;
  436. };
  437.  
  438. /*
  439. ===========
  440. PutClientInServer
  441.  
  442. called each time a player is spawned
  443. ============
  444. */
  445. void() DecodeLevelParms;
  446. void() PlayerDie;
  447.  
  448.  
  449. void() PutClientInServer =
  450. {
  451.     local    entity spot;
  452.  
  453.     self.classname = "player";
  454.     self.health = 100;
  455.     self.takedamage = DAMAGE_AIM;
  456.     self.solid = SOLID_SLIDEBOX;
  457.     self.movetype = MOVETYPE_WALK;
  458.     self.show_hostile = 0;
  459.     self.max_health = 100;
  460.     self.flags = FL_CLIENT;
  461.     self.air_finished = time + 12;
  462.     self.dmg = 2;           // initial water damage
  463.     self.super_damage_finished = 0;
  464.     self.radsuit_finished = 0;
  465.     self.invisible_finished = 0;
  466.     self.invincible_finished = 0;
  467.     self.effects = 0;
  468.     self.invincible_time = 0;
  469.  
  470.     DecodeLevelParms ();
  471.  
  472.     W_SetCurrentAmmo ();
  473.  
  474. //#Harlequin#  Resets camper warnings upon respawn
  475.     self.CAMPER_WARNING_ITEM1 = world;
  476.     self.CAMPER_WARNING_ITEM2 = world;
  477.     self.CAMPER_TIME = 0;
  478.     self.SNIPER_WARNING_ENTITY1 = world;
  479.     self.SNIPER_WARNING_ENTITY2 = world;
  480.     self.SNIPER_TIME = 0;
  481.     self.SHOWN_MESSAGE_TIME = 0;
  482.  
  483. //#Harlequin#  Only display welcome message if they just connected.  Yes, this is a hack.
  484.     if ((self.SHOWN_MESSAGE_COUNT < 11) && (self.weapon == 1) && (self.ammo_shells == 25) && (self.ammo_rockets == self.ammo_nails == self.ammo_cells == self.armortype == self.armorvalue == 0) && (self.health == 100))
  485.         self.SHOWN_MESSAGE_COUNT = 1;
  486.     else
  487.         self.SHOWN_MESSAGE_COUNT = 11;
  488. //#Harlequin#  End of my mods in this section
  489.     
  490.     self.attack_finished = time;
  491.     self.th_pain = player_pain;
  492.     self.th_die = PlayerDie;
  493.     
  494.     self.deadflag = DEAD_NO;
  495. // paustime is set by teleporters to keep the player from moving a while
  496.     self.pausetime = 0;
  497.     
  498.     spot = SelectSpawnPoint ();
  499.  
  500.     self.origin = spot.origin + '0 0 1';
  501.     self.angles = spot.angles;
  502.     self.fixangle = TRUE;        // turn this way immediately
  503.  
  504. // oh, this is a hack!
  505.     setmodel (self, "progs/eyes.mdl");
  506.     modelindex_eyes = self.modelindex;
  507.  
  508.     setmodel (self, "progs/player.mdl");
  509.     modelindex_player = self.modelindex;
  510.  
  511.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  512.     
  513.     self.view_ofs = '0 0 22';
  514.  
  515.     player_stand1 ();
  516.     
  517.     if (deathmatch || coop)
  518.     {
  519.         makevectors(self.angles);
  520.         spawn_tfog (self.origin + v_forward*20);
  521.     }
  522.  
  523.     spawn_tdeath (self.origin, self);
  524. };
  525.  
  526.  
  527. /*
  528. =============================================================================
  529.  
  530.                 QUAKED FUNCTIONS
  531.  
  532. =============================================================================
  533. */
  534.  
  535.  
  536. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  537. The normal starting point for a level.
  538. */
  539. void() info_player_start =
  540. {
  541. };
  542.  
  543.  
  544. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  545. Only used on start map for the return point from an episode.
  546. */
  547. void() info_player_start2 =
  548. {
  549. };
  550.  
  551.  
  552. /*
  553. saved out by quaked in region mode
  554. */
  555. void() testplayerstart =
  556. {
  557. };
  558.  
  559. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  560. potential spawning position for deathmatch games
  561. */
  562. void() info_player_deathmatch =
  563. {
  564.     precache_sound("dog/dsight.wav"); //#Harlequin#  Camper-warning sound
  565. };
  566.  
  567. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  568. potential spawning position for coop games
  569. */
  570. void() info_player_coop =
  571. {
  572. };
  573.  
  574.  
  575. /*
  576. ===============================================================================
  577.  
  578. RULES
  579.  
  580. ===============================================================================
  581. */
  582.  
  583. void(entity c) PrintClientScore =
  584. {
  585.     if (c.frags > -10 && c.frags < 0)
  586.         bprint (" ");
  587.     else if (c.frags >= 0)
  588.     {
  589.         if (c.frags < 100)
  590.             bprint (" ");
  591.         if (c.frags < 10)
  592.             bprint (" ");
  593.     }
  594.     bprint (ftos(c.frags));
  595.     bprint (" ");
  596.     bprint (c.netname);
  597.     bprint ("\n");
  598. };
  599.  
  600. void() DumpScore =
  601. {
  602.     local entity    e, sort, walk;
  603.  
  604.     if (world.chain)
  605.         error ("DumpScore: world.chain is set");
  606.  
  607. // build a sorted lis
  608.     e = find(world, classname, "player");
  609.     sort = world;
  610.     while (e)
  611.     {
  612.         if (!sort)
  613.         {
  614.             sort = e;
  615.             e.chain = world;
  616.         }
  617.         else
  618.         {
  619.             if (e.frags > sort.frags)
  620.             {
  621.                 e.chain = sort;
  622.                 sort = e;
  623.             }
  624.             else
  625.             {
  626.                 walk = sort;
  627.                 do
  628.                 {
  629.                     if (!walk.chain)
  630.                     {
  631.                         e.chain = world;
  632.                         walk.chain = e;
  633.                     }
  634.                     else if (walk.chain.frags < e.frags)
  635.                     {
  636.                         e.chain = walk.chain;
  637.                         walk.chain = e;
  638.                     }
  639.                     else
  640.                         walk = walk.chain;
  641.                 } while (walk.chain != e);
  642.             }
  643.         }
  644.         
  645.         e = find(e, classname, "player");
  646.     }
  647.  
  648. // print the list
  649.     
  650.     bprint ("\n");    
  651.     while (sort)
  652.     {
  653.         PrintClientScore (sort);
  654.         sort = sort.chain;
  655.     }
  656.     bprint ("\n");
  657. };
  658.  
  659. /*
  660. go to the next level for deathmatch
  661. */
  662. void() NextLevel =
  663. {
  664.     local entity o;
  665.  
  666. // find a trigger changelevel
  667.     o = find(world, classname, "trigger_changelevel");
  668.     if (!o || mapname == "start")
  669.     {    // go back to same map if no trigger_changelevel
  670.         o = spawn();
  671.         o.map = mapname;
  672.     }
  673.  
  674.     nextmap = o.map;
  675.     
  676.     if (o.nextthink < time)
  677.     {
  678.         o.think = execute_changelevel;
  679.         o.nextthink = time + 0.1;
  680.     }
  681. };
  682.  
  683. /*
  684. ============
  685. CheckRules
  686.  
  687. Exit deathmatch games upon conditions
  688. ============
  689. */
  690. void() CheckRules =
  691. {
  692.     local    float        timelimit;
  693.     local    float        fraglimit;
  694.     
  695.     if (gameover)    // someone else quit the game already
  696.         return;
  697.         
  698.     timelimit = cvar("timelimit") * 60;
  699.     fraglimit = cvar("fraglimit");
  700.     
  701.     if (timelimit && time >= timelimit)
  702.     {
  703. NextLevel ();
  704. /*
  705.         gameover = TRUE;
  706.         bprint ("\n\n\n==============================\n");
  707.         bprint ("game exited after ");
  708.         bprint (ftos(timelimit/60));
  709.         bprint (" minutes\n");
  710.         DumpScore ();
  711.         localcmd ("killserver\n");
  712. */
  713.         return;
  714.     }
  715.     
  716.     if (fraglimit && self.frags >= fraglimit)
  717.     {
  718. NextLevel ();
  719. /*
  720.         gameover = TRUE;
  721.         bprint ("\n\n\n==============================\n");
  722.         bprint ("game exited after ");
  723.         bprint (ftos(self.frags));
  724.         bprint (" frags\n");
  725.         DumpScore ();
  726.         localcmd ("killserver\n");
  727. */
  728.         return;
  729.     }    
  730. };
  731.  
  732. //============================================================================
  733.  
  734. void() PlayerDeathThink =
  735. {
  736.     local entity    old_self;
  737.     local float        forward;
  738.  
  739.     if ((self.flags & FL_ONGROUND))
  740.     {
  741.         forward = vlen (self.velocity);
  742.         forward = forward - 20;
  743.         if (forward <= 0)
  744.             self.velocity = '0 0 0';
  745.         else    
  746.             self.velocity = forward * normalize(self.velocity);
  747.     }
  748.  
  749. // wait for all buttons released
  750.     if (self.deadflag == DEAD_DEAD)
  751.     {
  752.         if (self.button2 || self.button1 || self.button0)
  753.             return;
  754.         self.deadflag = DEAD_RESPAWNABLE;
  755.         return;
  756.     }
  757.  
  758. // wait for any button down
  759.     if (!self.button2 && !self.button1 && !self.button0)
  760.         return;
  761.  
  762.     self.button0 = 0;
  763.     self.button1 = 0;
  764.     self.button2 = 0;
  765.     respawn();
  766. };
  767.  
  768.  
  769. void() PlayerJump =
  770. {
  771.     local vector start, end;
  772.  
  773. //#Harlequin#  So that convicted campers can't jump or swim
  774.     if (self.pausetime > time + 100)
  775.         return;    
  776. //#Harlequin#  End of my mods in this section
  777.  
  778.     if (self.flags & FL_WATERJUMP)
  779.         return;
  780.     
  781.     if (self.waterlevel >= 2)
  782.     {
  783.         if (self.watertype == CONTENT_WATER)
  784.             self.velocity_z = 100;
  785.         else if (self.watertype == CONTENT_SLIME)
  786.             self.velocity_z = 80;
  787.         else
  788.             self.velocity_z = 50;
  789.  
  790. // play swiming sound
  791.         if (self.swim_flag < time)
  792.         {
  793.             self.swim_flag = time + 1;
  794.             if (random() < 0.5)
  795.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  796.             else
  797.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  798.         }
  799.  
  800.         return;
  801.     }
  802.  
  803.     if (!(self.flags & FL_ONGROUND))
  804.         return;
  805.  
  806.     if ( !(self.flags & FL_JUMPRELEASED) )
  807.         return;        // don't pogo stick
  808.  
  809.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  810.  
  811.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  812.     
  813.     self.button2 = 0;
  814. // player jumping sound
  815.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  816.     self.velocity_z = self.velocity_z + 270;
  817. };
  818.  
  819.  
  820. /*
  821. ===========
  822. WaterMove
  823.  
  824. ============
  825. */
  826. .float    dmgtime;
  827.  
  828. void() WaterMove =
  829. {
  830. //dprint (ftos(self.waterlevel));
  831.     if (self.movetype == MOVETYPE_NOCLIP)
  832.         return;
  833.     if (self.health < 0)
  834.         return;
  835.  
  836.     if (self.waterlevel != 3)
  837.     {
  838.         if (self.air_finished < time)
  839.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  840.         else if (self.air_finished < time + 9)
  841.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  842.         self.air_finished = time + 12;
  843.         self.dmg = 2;
  844.     }
  845.     else if (self.air_finished < time)
  846.     {    // drown!
  847.         if (self.pain_finished < time)
  848.         {
  849.             self.dmg = self.dmg + 2;
  850.             if (self.dmg > 15)
  851.                 self.dmg = 10;
  852.             T_Damage (self, world, world, self.dmg);
  853.             self.pain_finished = time + 1;
  854.         }
  855.     }
  856.     
  857.     if (!self.waterlevel)
  858.     {
  859.         if (self.flags & FL_INWATER)
  860.         {    
  861.             // play leave water sound
  862.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  863.             self.flags = self.flags - FL_INWATER;
  864.         }
  865.         return;
  866.     }
  867.  
  868.     if (self.watertype == CONTENT_LAVA)
  869.     {    // do damage
  870.         if (self.dmgtime < time)
  871.         {
  872.             if (self.radsuit_finished > time)
  873.                 self.dmgtime = time + 1;
  874.             else
  875.                 self.dmgtime = time + 0.2;
  876.  
  877.             T_Damage (self, world, world, 10*self.waterlevel);
  878.         }
  879.     }
  880.     else if (self.watertype == CONTENT_SLIME)
  881.     {    // do damage
  882.         if (self.dmgtime < time && self.radsuit_finished < time)
  883.         {
  884.             self.dmgtime = time + 1;
  885.             T_Damage (self, world, world, 4*self.waterlevel);
  886.         }
  887.     }
  888.     
  889.     if ( !(self.flags & FL_INWATER) )
  890.     {    
  891.  
  892. // player enter water sound
  893.  
  894.         if (self.watertype == CONTENT_LAVA)
  895.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  896.         if (self.watertype == CONTENT_WATER)
  897.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  898.         if (self.watertype == CONTENT_SLIME)
  899.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  900.  
  901.         self.flags = self.flags + FL_INWATER;
  902.         self.dmgtime = 0;
  903.     }
  904.     
  905.     if (! (self.flags & FL_WATERJUMP) )
  906.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  907. };
  908.  
  909. void() CheckWaterJump =
  910. {
  911.     local vector start, end;
  912.  
  913. // check for a jump-out-of-water
  914.     makevectors (self.angles);
  915.     start = self.origin;
  916.     start_z = start_z + 8; 
  917.     v_forward_z = 0;
  918.     normalize(v_forward);
  919.     end = start + v_forward*24;
  920.     traceline (start, end, TRUE, self);
  921.     if (trace_fraction < 1)
  922.     {    // solid at waist
  923.         start_z = start_z + self.maxs_z - 8;
  924.         end = start + v_forward*24;
  925.         self.movedir = trace_plane_normal * -50;
  926.         traceline (start, end, TRUE, self);
  927.         if (trace_fraction == 1)
  928.         {    // open at eye level
  929.             self.flags = self.flags | FL_WATERJUMP;
  930.             self.velocity_z = 225;
  931.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  932.             self.teleport_time = time + 2;    // safety net
  933.             return;
  934.         }
  935.     }
  936. };
  937.  
  938.  
  939. /*
  940. ================
  941. PlayerPreThink
  942.  
  943. Called every frame before physics are run
  944. ================
  945. */
  946. void() PlayerPreThink =
  947. {
  948.     local    float    mspeed, aspeed;
  949.     local    float    r;
  950.  
  951.     if (intermission_running)
  952.     {
  953.         IntermissionThink ();    // otherwise a button could be missed between
  954.         return;                    // the think tics
  955.     }
  956.  
  957.     if (self.view_ofs == '0 0 0')
  958.         return;        // intermission or finale
  959.  
  960.     makevectors (self.v_angle);        // is this still used
  961.  
  962.     CheckRules ();
  963.     WaterMove ();
  964.  
  965.     if (self.waterlevel == 2)
  966.         CheckWaterJump ();
  967.  
  968.     if (self.deadflag >= DEAD_DEAD)
  969.     {
  970.         PlayerDeathThink ();
  971.         return;
  972.     }
  973.     
  974.     if (self.deadflag == DEAD_DYING)
  975.         return;    // dying, so do nothing
  976.  
  977.     if (self.button2)
  978.     {
  979.         PlayerJump ();
  980.     }
  981.     else
  982.         self.flags = self.flags | FL_JUMPRELEASED;
  983.  
  984. // teleporters can force a non-moving pause time    
  985.     if (time < self.pausetime)
  986.         self.velocity = '0 0 0';
  987. };
  988.     
  989. /*
  990. ================
  991. CheckPowerups
  992.  
  993. Check for turning off powerups
  994. ================
  995. */
  996. void() CheckPowerups =
  997. {
  998.     if (self.health <= 0)
  999.         return;
  1000.  
  1001. //#Harlequin#  If it's been > (thinktime + 1) seconds since a camper/sniper warning, you're cleared
  1002.     if (self.CAMPER_TIME && (self.CAMPER_TIME < time))
  1003.     {
  1004.         self.CAMPER_WARNING_ITEM1 = world;
  1005.         self.CAMPER_WARNING_ITEM2 = world;
  1006.         self.CAMPER_TIME = 0;
  1007.     }
  1008.     if (self.SNIPER_TIME && (self.SNIPER_TIME < time))
  1009.     {
  1010.         self.SNIPER_WARNING_ENTITY1 = world;
  1011.         self.SNIPER_WARNING_ENTITY2 = world;
  1012.         self.SNIPER_TIME = 0;
  1013.     }
  1014.  
  1015. //#Harlequin#  If you haven't seen the welcome message yet, print it
  1016.     if ((self.SHOWN_MESSAGE_COUNT < 4) && (self.SHOWN_MESSAGE_TIME < time))
  1017.     {
  1018.         centerprint(self, "this server is running\n┴ε⌠Θ├ßφ≡σ≥ v1.0\n**camp at your own risk!**\n");
  1019.         self.SHOWN_MESSAGE_COUNT = self.SHOWN_MESSAGE_COUNT + 1;
  1020.         self.SHOWN_MESSAGE_TIME = time + 1.7;
  1021.     }
  1022.  
  1023. //#Harlequin#  If you're busted, centerprint busted message continuously until you die
  1024.     if (self.pausetime > time + 100)
  1025.         centerprint(self, "Campers Suck!  Prepare To Die!!\n");
  1026. //#Harlequin#  End of my mods in this section
  1027.  
  1028. // invisibility
  1029.     if (self.invisible_finished)
  1030.     {
  1031. // sound and screen flash when items starts to run out
  1032.         if (self.invisible_sound < time)
  1033.         {
  1034.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  1035.             self.invisible_sound = time + ((random() * 3) + 1);
  1036.         }
  1037.  
  1038.  
  1039.         if (self.invisible_finished < time + 3)
  1040.         {
  1041.             if (self.invisible_time == 1)
  1042.             {
  1043.                 sprint (self, "Ring of Shadows magic is fading\n");
  1044.                 stuffcmd (self, "bf\n");
  1045.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  1046.                 self.invisible_time = time + 1;
  1047.             }
  1048.             
  1049.             if (self.invisible_time < time)
  1050.             {
  1051.                 self.invisible_time = time + 1;
  1052.                 stuffcmd (self, "bf\n");
  1053.             }
  1054.         }
  1055.  
  1056.         if (self.invisible_finished < time)
  1057.         {    // just stopped
  1058.             self.items = self.items - IT_INVISIBILITY;
  1059.             self.invisible_finished = 0;
  1060.             self.invisible_time = 0;
  1061.         }
  1062.         
  1063.     // use the eyes
  1064.         self.frame = 0;
  1065.         self.modelindex = modelindex_eyes;
  1066.     }
  1067.     else
  1068.         self.modelindex = modelindex_player;    // don't use eyes
  1069.  
  1070. // invincibility
  1071.     if (self.invincible_finished)
  1072.     {
  1073. // sound and screen flash when items starts to run out
  1074.         if (self.invincible_finished < time + 3)
  1075.         {
  1076.             if (self.invincible_time == 1)
  1077.             {
  1078.                 sprint (self, "Protection is almost burned out\n");
  1079.                 stuffcmd (self, "bf\n");
  1080.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1081.                 self.invincible_time = time + 1;
  1082.             }
  1083.             
  1084.             if (self.invincible_time < time)
  1085.             {
  1086.                 self.invincible_time = time + 1;
  1087.                 stuffcmd (self, "bf\n");
  1088.             }
  1089.         }
  1090.         
  1091.         if (self.invincible_finished < time)
  1092.         {    // just stopped
  1093.             self.items = self.items - IT_INVULNERABILITY;
  1094.             self.invincible_time = 0;
  1095.             self.invincible_finished = 0;
  1096.         }
  1097.         if (self.invincible_finished > time)
  1098.             self.effects = self.effects | EF_DIMLIGHT;
  1099.         else
  1100.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1101.     }
  1102.  
  1103. // super damage
  1104.     if (self.super_damage_finished)
  1105.     {
  1106.  
  1107. // sound and screen flash when items starts to run out
  1108.  
  1109.         if (self.super_damage_finished < time + 3)
  1110.         {
  1111.             if (self.super_time == 1)
  1112.             {
  1113.                 sprint (self, "Quad Damage is wearing off\n");
  1114.                 stuffcmd (self, "bf\n");
  1115.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1116.                 self.super_time = time + 1;
  1117.             }      
  1118.             
  1119.             if (self.super_time < time)
  1120.             {
  1121.                 self.super_time = time + 1;
  1122.                 stuffcmd (self, "bf\n");
  1123.             }
  1124.         }
  1125.  
  1126.         if (self.super_damage_finished < time)
  1127.         {    // just stopped
  1128.             self.items = self.items - IT_QUAD;
  1129.             self.super_damage_finished = 0;
  1130.             self.super_time = 0;
  1131.         }
  1132.         if (self.super_damage_finished > time)
  1133.             self.effects = self.effects | EF_DIMLIGHT;
  1134.         else
  1135.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1136.     }    
  1137.  
  1138. // suit    
  1139.     if (self.radsuit_finished)
  1140.     {
  1141.         self.air_finished = time + 12;        // don't drown
  1142.  
  1143. // sound and screen flash when items starts to run out
  1144.         if (self.radsuit_finished < time + 3)
  1145.         {
  1146.             if (self.rad_time == 1)
  1147.             {
  1148.                 sprint (self, "Air supply in Biosuit expiring\n");
  1149.                 stuffcmd (self, "bf\n");
  1150.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1151.                 self.rad_time = time + 1;
  1152.             }
  1153.             
  1154.             if (self.rad_time < time)
  1155.             {
  1156.                 self.rad_time = time + 1;
  1157.                 stuffcmd (self, "bf\n");
  1158.             }
  1159.         }
  1160.  
  1161.         if (self.radsuit_finished < time)
  1162.         {    // just stopped
  1163.             self.items = self.items - IT_SUIT;
  1164.             self.rad_time = 0;
  1165.             self.radsuit_finished = 0;
  1166.         }
  1167.     }    
  1168.  
  1169. };
  1170.  
  1171.  
  1172. /*
  1173. ================
  1174. PlayerPostThink
  1175.  
  1176. Called every frame after physics are run
  1177. ================
  1178. */
  1179. void() PlayerPostThink =
  1180. {
  1181.     local    float    mspeed, aspeed;
  1182.     local    float    r;
  1183.  
  1184.     if (self.view_ofs == '0 0 0')
  1185.         return;        // intermission or finale
  1186.     if (self.deadflag)
  1187.         return;
  1188.         
  1189. // do weapon stuff
  1190.  
  1191.     W_WeaponFrame ();
  1192.  
  1193. // check to see if player landed and play landing sound    
  1194.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1195.     {
  1196.         if (self.watertype == CONTENT_WATER)
  1197.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1198.         else if (self.jump_flag < -650)
  1199.         {
  1200.             T_Damage (self, world, world, 5); 
  1201.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1202.             self.deathtype = "falling";
  1203.         }
  1204.         else
  1205.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1206.  
  1207.         self.jump_flag = 0;
  1208.     }
  1209.  
  1210.     if (!(self.flags & FL_ONGROUND))
  1211.         self.jump_flag = self.velocity_z;
  1212.  
  1213.     CheckPowerups ();
  1214. };
  1215.  
  1216.  
  1217. /*
  1218. ===========
  1219. ClientConnect
  1220.  
  1221. called when a player connects to a server
  1222. ============
  1223. */
  1224. void() ClientConnect =
  1225. {
  1226.     bprint (self.netname);
  1227.     bprint (" entered the game\n");
  1228.  
  1229. // a client connecting during an intermission can cause problems
  1230.     if (intermission_running)
  1231.         ExitIntermission ();
  1232. };
  1233.  
  1234.  
  1235. /*
  1236. ===========
  1237. ClientDisconnect
  1238.  
  1239. called when a player disconnects from a server
  1240. ============
  1241. */
  1242. void() ClientDisconnect =
  1243. {
  1244.     if (gameover)
  1245.         return;
  1246.     // if the level end trigger has been activated, just return
  1247.     // since they aren't *really* leaving
  1248.  
  1249.     // let everyone else know
  1250.     bprint (self.netname);
  1251.     bprint (" left the game with ");
  1252.     bprint (ftos(self.frags));
  1253.     bprint (" frags\n");
  1254.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1255.     set_suicide_frame ();
  1256. };
  1257.  
  1258. /*
  1259. ===========
  1260. ClientObituary
  1261.  
  1262. called when a player dies
  1263. ============
  1264. */
  1265. void(entity targ, entity attacker) ClientObituary =
  1266. {
  1267.     local    float rnum;
  1268.     local    string deathstring, deathstring2;
  1269.     rnum = random();
  1270.  
  1271.     if (targ.classname == "player")
  1272.     {
  1273. //#Harlequin#  Next line is mine, to avoid showing welcome message again upon respawn
  1274.         targ.SHOWN_MESSAGE_COUNT = 11;
  1275.         if (attacker.classname == "teledeath")
  1276.         {
  1277.             bprint (targ.netname);
  1278.             bprint (" was telefragged by ");
  1279.             bprint (attacker.owner.netname);
  1280.             bprint ("\n");
  1281.  
  1282.             attacker.owner.frags = attacker.owner.frags + 1;
  1283.             return;
  1284.         }
  1285.  
  1286.         if (attacker.classname == "teledeath2")
  1287.         {
  1288.             bprint ("Satan's power deflects ");
  1289.             bprint (targ.netname);
  1290.             bprint ("'s telefrag\n");
  1291.  
  1292.             targ.frags = targ.frags - 1;
  1293.             return;
  1294.         }
  1295.  
  1296.         if (attacker.classname == "player")
  1297.         {
  1298.             if (targ == attacker)
  1299.             {
  1300.                 // killed self
  1301.                 attacker.frags = attacker.frags - 1;
  1302.                 bprint (targ.netname);
  1303.                 
  1304.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1305.                 {
  1306.                     bprint (" discharges into the water.\n");
  1307.                     return;
  1308.                 }
  1309.                 if (targ.weapon == 16)
  1310.                     bprint (" tries to put the pin back in\n");
  1311.                 else if (rnum)
  1312.                     bprint (" becomes bored with life\n");
  1313.                 else
  1314.                     bprint (" checks if his weapon is loaded\n");
  1315.                 return;
  1316.             }
  1317.             else
  1318.             {
  1319.                 attacker.frags = attacker.frags + 1;
  1320.  
  1321.                 rnum = attacker.weapon;
  1322.                 if (rnum == IT_AXE)
  1323.                 {
  1324.                     deathstring = " was ax-murdered by ";
  1325.                     deathstring2 = "\n";
  1326.                 }
  1327.                 if (rnum == IT_SHOTGUN)
  1328.                 {
  1329.                     deathstring = " chewed on ";
  1330.                     deathstring2 = "'s boomstick\n";
  1331.                 }
  1332.                 if (rnum == IT_SUPER_SHOTGUN)
  1333.                 {
  1334.                     deathstring = " ate 2 loads of ";
  1335.                     deathstring2 = "'s buckshot\n";
  1336.                 }
  1337.                 if (rnum == IT_NAILGUN)
  1338.                 {
  1339.                     deathstring = " was nailed by ";
  1340.                     deathstring2 = "\n";
  1341.                 }
  1342.                 if (rnum == IT_SUPER_NAILGUN)
  1343.                 {
  1344.                     deathstring = " was punctured by ";
  1345.                     deathstring2 = "\n";
  1346.                 }
  1347.                 if (rnum == IT_GRENADE_LAUNCHER)
  1348.                 {
  1349.                     deathstring = " eats ";
  1350.                     deathstring2 = "'s pineapple\n";
  1351.                     if (targ.health < -40)
  1352.                     {
  1353.                         deathstring = " was gibbed by ";
  1354.                         deathstring2 = "'s grenade\n";
  1355.                     }
  1356.                 }
  1357.                 if (rnum == IT_ROCKET_LAUNCHER)
  1358.                 {
  1359.                     deathstring = " rides ";
  1360.                     deathstring2 = "'s rocket\n";
  1361.                     if (targ.health < -40)
  1362.                     {
  1363.                         deathstring = " was gibbed by ";
  1364.                         deathstring2 = "'s rocket\n" ;
  1365.                     }
  1366.                 }
  1367.                 if (rnum == IT_LIGHTNING)
  1368.                 {
  1369.                     deathstring = " accepts ";
  1370.                     if (attacker.waterlevel > 1)
  1371.                         deathstring2 = "'s discharge\n";
  1372.                     else
  1373.                         deathstring2 = "'s shaft\n";
  1374.                 }
  1375.  
  1376. //#Harlequin#  New deathstring and extra frags for camper-killing
  1377.                 if (targ.pausetime > (time + 100))
  1378.                 {
  1379.                     bprint (attacker.netname);
  1380.                     bprint (" teaches ");
  1381.                     bprint (targ.netname);
  1382.                     bprint (" not to camp!\n");
  1383.                     attacker.frags = attacker.frags + 2;
  1384.                 }
  1385.  
  1386.                 else
  1387.                 {
  1388.                     bprint (targ.netname);
  1389.                     bprint (deathstring);
  1390.                     bprint (attacker.netname);
  1391.                     bprint (deathstring2);
  1392.                 }
  1393. //#Harlequin#  End of my mods in this section
  1394.  
  1395.             }
  1396.             return;
  1397.         }
  1398.         else
  1399.         {
  1400.             targ.frags = targ.frags - 1;        // killed self
  1401.             rnum = targ.watertype;
  1402.  
  1403.             bprint (targ.netname);
  1404.             if (rnum == -3)
  1405.             {
  1406.                 if (random() < 0.5)
  1407.                     bprint (" sleeps with the fishes\n");
  1408.                 else
  1409.                     bprint (" sucks it down\n");
  1410.                 return;
  1411.             }
  1412.             else if (rnum == -4)
  1413.             {
  1414.                 if (random() < 0.5)
  1415.                     bprint (" gulped a load of slime\n");
  1416.                 else
  1417.                     bprint (" can't exist on slime alone\n");
  1418.                 return;
  1419.             }
  1420.             else if (rnum == -5)
  1421.             {
  1422.                 if (targ.health < -15)
  1423.                 {
  1424.                     bprint (" burst into flames\n");
  1425.                     return;
  1426.                 }
  1427.                 if (random() < 0.5)
  1428.                     bprint (" turned into hot slag\n");
  1429.                 else
  1430.                     bprint (" visits the Volcano God\n");
  1431.                 return;
  1432.             }
  1433.  
  1434.             if (attacker.flags & FL_MONSTER)
  1435.             {
  1436.                 if (attacker.classname == "monster_army")
  1437.                     bprint (" was shot by a Grunt\n");
  1438.                 if (attacker.classname == "monster_demon1")
  1439.                     bprint (" was eviscerated by a Fiend\n");
  1440.                 if (attacker.classname == "monster_dog")
  1441.                     bprint (" was mauled by a Rottweiler\n");
  1442.                 if (attacker.classname == "monster_dragon")
  1443.                     bprint (" was fried by a Dragon\n");
  1444.                 if (attacker.classname == "monster_enforcer")
  1445.                     bprint (" was blasted by an Enforcer\n");
  1446.                 if (attacker.classname == "monster_fish")
  1447.                     bprint (" was fed to the Rotfish\n");
  1448.                 if (attacker.classname == "monster_hell_knight")
  1449.                     bprint (" was slain by a Death Knight\n");
  1450.                 if (attacker.classname == "monster_knight")
  1451.                     bprint (" was slashed by a Knight\n");
  1452.                 if (attacker.classname == "monster_ogre")
  1453.                     bprint (" was destroyed by an Ogre\n");
  1454.                 if (attacker.classname == "monster_oldone")
  1455.                     bprint (" became one with Shub-Niggurath\n");
  1456.                 if (attacker.classname == "monster_shalrath")
  1457.                     bprint (" was exploded by a Vore\n");
  1458.                 if (attacker.classname == "monster_shambler")
  1459.                     bprint (" was smashed by a Shambler\n");
  1460.                 if (attacker.classname == "monster_tarbaby")
  1461.                     bprint (" was slimed by a Spawn\n");
  1462.                 if (attacker.classname == "monster_vomit")
  1463.                     bprint (" was vomited on by a Vomitus\n");
  1464.                 if (attacker.classname == "monster_wizard")
  1465.                     bprint (" was scragged by a Scrag\n");
  1466.                 if (attacker.classname == "monster_zombie")
  1467.                     bprint (" joins the Zombies\n");
  1468.  
  1469.                 return;
  1470.             }
  1471.             if (attacker.classname == "explo_box")
  1472.             {
  1473.                 bprint (" blew up\n");
  1474.                 return;
  1475.             }
  1476.             if (attacker.solid == SOLID_BSP && attacker != world)
  1477.             {    
  1478.                 bprint (" was squished\n");
  1479.                 return;
  1480.             }
  1481.             if (targ.deathtype == "falling")
  1482.             {
  1483.                 targ.deathtype = "";
  1484.                 bprint (" fell to his death\n");
  1485.                 return;
  1486.             }
  1487.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1488.             {
  1489.                 bprint (" was spiked\n");
  1490.                 return;
  1491.             }
  1492.             if (attacker.classname == "fireball")
  1493.             {
  1494.                 bprint (" ate a lavaball\n");
  1495.                 return;
  1496.             }
  1497.             if (attacker.classname == "trigger_changelevel")
  1498.             {
  1499.                 bprint (" tried to leave\n");
  1500.                 return;
  1501.             }
  1502.  
  1503.             bprint (" died\n");
  1504.         }
  1505.     }
  1506. };
  1507.